<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>单位</title>
        <style type="text/css">
            .tableStyle{
                margin:10px 0px 5px 0px;
            }
            .gridStyle{
                margin:10px 10px 10px 0px;
            }
            input{
                margin:1px 1px 1px 2px;
            }
            input[type='submit']{
                margin:3px 5px 3px 5px;
                padding:2px 5px 2px 5px;
            }
        </style>
    </h:head>
    <h:body>
        <h:form>
            <rich:panel header="单位信息" id="orgPanel" styleClass="content-hight">
                <rich:messages globalOnly="true"/>
                <rich:toolbar>
                    <rich:toolbarGroup>
                        <a4j:commandButton value="新建" execute="@this" render="orgPanel" action="#{organizationBean.add}"/>
                        <a4j:commandButton value="修改" render="orgPanel" action="#{organizationBean.update}"
                                           disabled="#{organizationBean.addOrUpdate || organizationBean.org eq null}"/>
                        <a4j:commandButton value="删除" render="orgPanel" action="#{organizationBean.delete}"
                                           disabled="#{organizationBean.addOrUpdate || organizationBean.org eq null}"/>
                        <a4j:commandButton value="保存" render="orgPanel"
                                           action="#{organizationBean.checkSave}"
                                           disabled="#{!organizationBean.editStatus}"/>
                        <a4j:commandButton value="取消" render="orgPanel" action="#{organizationBean.cancel}"
                                           immediate="true"/>
                    </rich:toolbarGroup>
                </rich:toolbar>
                <h:panelGrid columns="2" width="100%" columnClasses="col1,col2"  id="edit">
                    <rich:tree value="#{organizationBean.rootNode}" var="idept"
                               selectionType="ajax" toggleType="client"
                               selectionChangeListener="#{organizationBean.selected}"
                               style="width:300px" render="orgPanel">
                        <rich:treeNode>
                            <h:outputText value="[#{idept.data.code}]#{idept.data.name}" />
                        </rich:treeNode>
                    </rich:tree>
                    <h:panelGroup style="margin:10px">
                        <h:panelGrid columns="3" id="deptinfo" styleClass="gridStyle">
                            <h:outputText value="代码："/>
                            <h:outputText rendered="#{!organizationBean.editStatus}" value="#{organizationBean.org.code}"/>
                            <h:inputText rendered="#{organizationBean.editStatus}" disabled="#{!organizationBean.addOrUpdate}"
                                         id="code" value="#{organizationBean.org.code}"
                                         required="true" requiredMessage="代码不能为空！">
                            </h:inputText>
                            <rich:message for="code"/>
                            <h:outputText value="名称："/>
                            <h:outputText rendered="#{!organizationBean.editStatus}" value="#{organizationBean.org.name}"/>
                            <h:inputText rendered="#{organizationBean.editStatus}" id="name"
                                         value="#{organizationBean.org.name}"
                                         required="true" requiredMessage="名称不能为空！"/>
                            <rich:message for="name"/>
                        </h:panelGrid>
                    </h:panelGroup>
                </h:panelGrid>
            </rich:panel>
        </h:form>
    </h:body>
</html>
